class MonedasController < ApplicationController
  # GET /monedas
  # GET /monedas.xml
  def index
    @monedas = Moneda.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @monedas.to_xml }
    end
  end

  # GET /monedas/1
  # GET /monedas/1.xml
  def show
    @moneda = Moneda.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @moneda.to_xml }
    end
  end

  # GET /monedas/new
  def new
    @moneda = Moneda.new
  end

  # GET /monedas/1;edit
  def edit
    @moneda = Moneda.find(params[:id])
  end

  # POST /monedas
  # POST /monedas.xml
  def create
    @moneda = Moneda.new(params[:moneda])

    respond_to do |format|
      if @moneda.save
        flash[:notice] = 'Moneda was successfully created.'
        format.html { redirect_to moneda_url(@moneda) }
        format.xml  { head :created, :location => moneda_url(@moneda) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @moneda.errors.to_xml }
      end
    end
  end

  # PUT /monedas/1
  # PUT /monedas/1.xml
  def update
    @moneda = Moneda.find(params[:id])

    respond_to do |format|
      if @moneda.update_attributes(params[:moneda])
        flash[:notice] = 'Moneda was successfully updated.'
        format.html { redirect_to moneda_url(@moneda) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @moneda.errors.to_xml }
      end
    end
  end

  # DELETE /monedas/1
  # DELETE /monedas/1.xml
  def destroy
    @moneda = Moneda.find(params[:id])
    @moneda.destroy

    respond_to do |format|
      format.html { redirect_to monedas_url }
      format.xml  { head :ok }
    end
  end
end
